/*
 * @Author: yujianxia
 * @Date: 2021-05-17 16:39:04
 * @LastEditTime: 2021-05-17 16:39:50
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \base-framework-web\src\models\auditDetail.js
 */
/**
 * auditDetail.js
 * 路由数据共享
 */
export default {
  namespace: 'auditDetail',
  state: {
    tags: [], // tabs列表
    cleartag: [], // 要关闭的tab
    setTags: null, // 操作tabs的方法
  },
  reducers: {
    // 操作tabs
    changeTabs(state, { payload }) {
      return { ...state, ...payload };
    },
    // 过滤掉关闭的tab
    removeTabs(state, { payload }) {
      state.cleartag = state.tags.filter(
        (item) => item.path === payload.removeTabsPathname,
      );
      state.tags = state.tags.filter(
        (item) => item.path !== payload.removeTabsPathname,
      );
      return { ...state };
    },
  },
};
